Skip to content

feat: add Mathpix PDF extraction - #26

Open
m-messer wants to merge 1 commit into
llm-clientfrom
mathpix
Open

feat: add Mathpix PDF extraction#26
m-messer wants to merge 1 commit into
llm-clientfrom
mathpix

Conversation

@m-messer

@m-messer m-messer commented Sep 1, 2026

Copy link
Copy Markdown
Member

in2lambda/wizard/mathpix.py: pdf_to_markdown() uploads a PDF to the Mathpix OCR API, polls for the rendered markdown, downloads any remote figures into <out_dir>/media/, and repoints the markdown at ./media/<name> so the Markdown filter's image resolution finds them.

  • Credentials from $MATHPIX_APP_ID / $MATHPIX_API_KEY; a missing pair raises a clear RuntimeError.
  • Only needs requests (already a core dep), so the module imports without the llm extra.
  • Ported and cleaned up from conversion2025/converter.py on Summer2025: print/exit calls become exceptions, the PIL round-trip is dropped (bytes stream straight to disk), poll interval/count are parameters.
  • Tests mock all HTTP.

⚠️ Not yet exercised against the live Mathpix service — tests are fully mocked. Live PDF run pending.


Stack: llm-client ← mathpix ← wizard-command
Base: llm-client#25.

🤖 Generated with Claude Code

in2lambda/wizard/mathpix.py: pdf_to_markdown() uploads a PDF to the Mathpix
OCR API, polls for the rendered markdown, downloads any remote figures into
<out_dir>/media/, and repoints the markdown at ./media/<name> so the
Markdown filter's image resolution finds them.

- Credentials from $MATHPIX_APP_ID / $MATHPIX_API_KEY; a missing pair raises
  a clear RuntimeError.
- Only needs `requests` (already a core dep), so the module imports without
  the llm extra.
- Ported and cleaned up from conversion2025/converter.py on Summer2025:
  print/exit calls become exceptions, the PIL round-trip is dropped (bytes
  are streamed straight to disk), poll interval/count are parameters.

Tests mock all HTTP.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017VXb8aZqgFBjoeuuddjW6r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant